﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using LibraryBLL.BookBLL;

namespace WebAppLibrary.Json
{
    /// <summary>
    /// 得到具体类型的内容
    /// </summary>
    public partial class GetBookByTypeId : System.Web.UI.Page
    {
        protected string strJson = string.Empty;
        BookTypeBLL btl = new BookTypeBLL(); 

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                ShowData();
            }
            catch (Exception ex)
            {
                strJson = @"{success: false}";//失败
                throw new Exception(ex.Message);
            }
        }

        private void ShowData()
        {
            if (Request.Form["typeId"] != null)
            {
                int typeId = int.Parse(Request.Form["typeId"]);
                strJson = btl.GetBookByTypeId(typeId);
            }
            else
            {
                strJson = btl.GetBookByTypeId(1);
            }

        }
    }
}
